import request from '@/utils/request'
import { AxiosResponse } from 'axios'
import { RingtonesRes } from './type'

enum Ringtone_API {
  GET_ALL_RINGTONE_LIST = '/transaction_assistant/ringtone/list',
  PUT_RINGTONE_SELECTION = '/transaction_assistant/ringtone/select/{id}',
}

/**
 * 获取所有铃声
 * @returns
 */
export const reqGetAllRingtone = () =>
  request.get<any, AxiosResponse<RingtonesRes[]>>(
    Ringtone_API.GET_ALL_RINGTONE_LIST,
  )

/**
 * 更改铃声选择
 * @param {string} id
 * @returns
 */
export const reqChangeRingtoneSelection = (ringtoneId: number) =>
  request.put<any, AxiosResponse<any>>(
    Ringtone_API.PUT_RINGTONE_SELECTION.replace('{id}', ringtoneId.toString()),
  )
